<template lang="html">
  <el-form ref="form" :model="form" label-width="80px" style="height:100px;">
<el-form-item label="围栏名称">
  <el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="围栏类型">
  <el-select v-model="form.geotype" placeholder="请选择围栏类型">
    <el-option label="封闭" value="fengbi"></el-option>
    <el-option label="自由通过" value="ziyoutongg"></el-option>
  </el-select>
</el-form-item>
<el-form-item>
  <el-button type="primary" @click="onSubmit">创建</el-button>
  <el-button @click="cancel">取消</el-button>
</el-form-item>
</el-form>
</template>
<script>
export default {
  data() {
    return {
      form: {
        name: "",
        geotype: ""
      }
    };
  },
  props: {
    info: {
      type: Object,
      default: () => {
        return {};
      }
    },
    layerid: {
      type: String,
      default: ""
    },
    fn: {
      type: Function,
      default: function () { }
    },
    lydata: {
      type: Object,
      default: () => {
        return {};
      }
    }
  },
  methods: {
    onSubmit() {
      // console.log("submit!");
      // alert(JSON.stringify(this.form));
      // console.log(this.parent);
      // console.log("$parent");
      // console.log(this.$parent);
      // console.log(this.form);
      this.$layer.msg("提交成功", () => {
        this.lydata.info.name = this.form.name;
        this.$layer.close(this.layerid);
      });
      // this.$parent.$emit('asd', 'kkk');
    },
    cancel() {
      this.fn();
      this.$layer.close(this.layerid);
    }
  },
  mounted() {
    this.form = this.info;
  }
};
</script>

<style lang="css">
</style>